<?php
/**
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 */
defined ('IN_AGORA') or die;

class AgoraPollsController extends AgoraController {

	function __construct() {
		parent::__construct();

		// Iskar - This is wrong, there is possibility for guests to create polls if they have this right
		/*
		if ($this->agora_user['is_guest']) {
			Agora::showError('Bad request');
			$this->redirect('task=index','!action');
		}
		*/
		
		$this->loadDefaultView();

		$this->id = Agora::getVar('id');

		if (!$this->id && Agora::getVar('action') !== 'select_forum' ) {
			Agora::showError(Agora::lang('Bad request'));
			Agora::redirect(Agora::getRefferer());
		}
		$this->model = & Model::getInstance('PollModel');

		$smilies_model = & Model::getInstance('SmiliesModel');
		$smilies = $smilies_model->loadAll();

		$this->view->assignRef('smilies',$smilies);

		$icons_model = & Model::getInstance('TopicIconsModel');
		$topic_icons = $icons_model->loadAll();

		$this->view->assignRef('topic_icons',$topic_icons);
		$this->view->assign('cur_forum_id',$this->id);
	}

	function redirect() {
		Agora::redirect(Agora::makeURL(array('task' => 'topic', 'id' => $this->id)));
	}

}
	
?>
